package com.lsw.photoview;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup.LayoutParams;

import com.lsw.R;


/**
 * 保存图片的弹窗提示
 *
 * @author Mars
 */
public class SavePhotoPopActivity extends Activity {
    public static boolean isSave;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.pub_item_popu_save_photo);
        getWindow().setLayout(LayoutParams.MATCH_PARENT,
                LayoutParams.WRAP_CONTENT);
        isSave = false;
        findViewById(R.id.pop_layout).setOnClickListener(
                new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        finish();
                    }
                });

        findViewById(R.id.btnSave).setOnClickListener(
                new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        isSave = true;
                        setResult(RESULT_OK);
                        finish();
                    }
                });
        // 取消
        findViewById(R.id.btnCancel).setOnClickListener(
                new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        finish();
                    }
                });
    }

    /**
     * 打开
     *
     * @param context
     * @param requestCode
     */
    public static void open(Activity context, int requestCode) {
        Intent intent = new Intent(context, SavePhotoPopActivity.class);
        context.startActivityForResult(intent, requestCode);
    }
}
